import request from '~/utils/resquest'

// 工单待办
export const getTodoList = <T>(params: T) => {
  return request({ url: '/api/gxsaas-flowable/flowable/flowTask/listTodo', method: 'GET', params })
}

// 工单已办
export const getDoneList = <T>(params: T) => {
  return request({ url: '/api/gxsaas-flowable/flowable/flowTask/listDone', method: 'GET', params })
}

// 工单抄送
export const getToCcList = <T>(params: T) => {
  return request({ url: '/api/gxsaas-flowable/flowable/flowTask/listToCc', method: 'GET', params })
}

// 工单提交
export const getToSubmitList = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-flowable/flowable/flowTask/listToSubmit',
    method: 'GET',
    params
  })
}

// 获取工单待办流程记录列表
export const getToDoProcessRecordList = <T>(params: T) => {
  return request({ url: '/api/gxsaas-flowable/flowable/flowTask/comments', method: 'GET', params })
}

// 查询待办查看可操作按钮列表
export const getTodoViewOptionButtonList = <T>(params: T) => {
  return request({
    url: '/api/gxsaas-flowable/flowable/flowTask/executeTaskData',
    method: 'GET',
    params
  })
}

// 回退工单任务 驳回、回退
export const backOrderFlowTask = <T>(data: T) =>
  request({ url: '/api/gxsaas-flowable/flowable/flowTask/back', method: 'PUT', data })

// 提交工单任务/处理工单任务/终结工单任务/工单任务归档/发送工单任务/完成工单任务
export const submitOrderFlowTask = <T>(data: T) =>
  request({ url: '/api/gxsaas-flowable/flowable/flowTask/complete', method: 'PUT', data })

// 删除工单任务
export const deleteOrderFlowTask = <T>(data: T) =>
  request({ url: '/api/gxsaas-flowable/flowable/flowTask/delete', method: 'PUT', data })

// 待办类型下拉列表
export const getToDoTypeSelectList = () => request({ url: '', method: 'get' })
